/* eslint-disable */
export default {
  data() {
        return {
            pageSize: 50,
            currentPage: 1,
            totalRecored: 0,
            loading: true,
            filterForm: {}
        }
    },
  methods: {
    handleSizeChange(val) {
        this.pageSize = val
        this.handleQuery(this.filterForm)
    },
    handleCurrentChange(val) {
        this.currentPage = val
        this.handleQuery(this.filterForm)
    },
    // 搜索
    handleQuery(val = {}) {
        if (Object.keys(val).length === 0) {
            this.currentPage = 1
        }
        Object.assign(val, this.sortParams)
        const params = JSON.parse(JSON.stringify(val))
        if (params.date) {
            if (params.date.length > 0) {
                params.startTime = params.date[0]
                params.endTime = params.date[1]
            }
            delete params.date
        }
        params.size = this.pageSize
        params.current = this.currentPage
        this.filterForm = params
        this.checkQuery(params)
    },
    // 付空搜索条件
    checkQuery(obj) {
        for (const i in obj) {
            if (!obj[i] || obj[i].length === 0) {
                obj[i] = null
            }
        }
        this.outPutParams = obj
        this.loadData(obj)
    },
    // 确认框操作
    sureDelete(text, callback) {
        this.$confirm(text, {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(valid => {
            if (callback) {
                callback()
            }
        }).catch(() => {
            console.log('取消')
        })
    }
  }
}
